home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: MegaDisc
/
MegaDisc 45 (1996-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].zip
/
MegaDisc 45 (1996-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].adf
/
arexx
/
Extensions.txt
/
Extensions.txt
Wrap
Text File
|
1996-01-23
|
23KB
|
502 lines
ZedREXX and varexx
by John Collett
First Impressions of
Two Extensions to ARexx
The absence of a Graphical User Interface in ARexx has always
appeared to me to be one of its surprising features, and in the past
we have had to use libraries such as 'rexxarplib.library' to enable
us to add windows, gadgets, etc. to our ARexx programs. Now another
kind of interface has appeared, responsive, for example, to different
fonts, with new categories of user gadgets, and adding a different
kind of graphical interface to ARexx programs.
The two programs I shall discuss here both offer such a GUI interface
to ARexx, but my experiences with them are very different.
First I spotted ZedREXX, published by Reality Check, Inc. :
A REXX Language Extension that adds sophisticated
Graphical User Interface capabilities using an
easy-to-use yet extremely powerful syntax.
It looked promising. I read the intro etc. and I got the demo to
work. So I thought it was an idea worth pursuing. I sent off my
money, and received the disk and docs of a registered user, and a
covering letter. There were only about 20 pages of docs, and I'll
quote briefly from the letter :
The preliminary version of the printed manual only shows
the commands and options that ZedREXX supports. When the
final version is completed, which will include tutorials
and special How-To sections, you will receive the update
at no additional charge.
I waited months for the update. I sent a enquiry. I waited. I sent
a reminder. I'm still waiting. They have not even had the courtesy
to acknowledge my mail.
Bye bye, ZedREXX. Hello, varexx
There are 'Charts' available through aminet, where we can look up
which programs are in the current top ten - the most frequently
looked at or down-loaded files. That was where I first spotted
'varexx', by Andrew Cook. From the file 'varexx.readme' :
A GUI system for Arexx. v1.4
Author: amc93el@soton.ac.uk (Andy Cook)
Requires: OS 2.04+, Arexx, Gadtoolsbox is required to create new GUI's
but is not needed to use other peoples scripts.
Reqtools.library and arexxport.library are needed (and both
included).
Version: 1.4
Varexx is a program that allows you to control graphical user
interfaces (GUI's) from arexx scripts. The program loads the .gui
files that are saved by Jan van den Baard's Gadtoolsbox program and
displays them on the screen.
Arexx scripts can then send messages to a port and control the actions
of the Gui. The script can read and set the contents of each of the
gadgets, resize the window and such like.
I down-loaded it straight away, and entered directly into that kind of
friendly, supportive computing environment that we all dream of.
Andrew invited communication, and I communicated. He replied
instantly, in a full and helpful way, and we had a quick series of
email exchanges - almost as if he was looking over my shoulder and
prompting me as to what to do next. Everything worked beautifully.
I even got, on December 24, a super Christmas greeting from Andrew,
in which he expressed the hope that he would be hearing again from me
in the new year. He will.
Just look at the contrast
You pay for ZedREXX, and on-going support is zero.
Varexx is free, and the author goes out of his way
to be supportive and friendly.
Ah yes, you may say, but how do the two systems compare in what they
do and how they do it? They seem to be covering similar if not
identical areas, but I cannot make an honest and informed comparison,
because I have seen so little output from ZedREXX. The little I have
seen suggests that I shall survive without using it.
----
Late insertion
I have just spotted EasyRexx in aminet, and had
a quick look at it. It may be similar to the two extensions I am
discussing, but I haven't examined it closely. (Its author is
certainly not going to die of modesty.)
----
Meanwhile my exploration of 'varexx' gets more interesting as I go.
I still have much ground to cover but, after listing the samples and
explaining a few preliminaries, I'll illustrate the potential of this
program with some of the 'first step' programs which I have pieced
together.
Sample programs provided
In the 'scripts' directory of version 1.4 of varexx there are the
following programs:
Demo.rexx An excellent straight-through demo of what varexx can do
TestGUI.rexx For preliminary inspection of any guis you create.
Takes the path and name of the gui as an argument,
e.g. rx TestGUI.rexx rexx:gui/sample_gui
If no arg is given, a file requester appears.
TestGUI2.rexx Also for inspecting guis, but in cases where you
have more than one window in a file, this lets you choose
which particular window file you wish to inspect.
Address.rexx An address book.
Also, in the full docs to varexx, there is an example of a script
outline. I lifted it out, called it vasample.rexx, and have used it
as a basis for much of my own exploratory varexx work. It has been a
good foundation for learning.
Preliminaries
When I had down-loaded 'varexx' and had my first look at its
requirements, I noted that the graphics files it uses have to be
created by Gadtoolsbox. I didn't have GTB, but found it on aminet,
and down-loaded it. Like all programs obtained from that source, it
had to be unpacked from the '.lha' format. As I watched the unpacking
list unroll on the screen, all 106 files of it, my heart fell. Here
was a
giant
to be mastered, before I could even start on 'varexx',
and in a fit of impatience I sent moaning and complaining mail to
Andrew Cook. He calmed me down in his very kind reply. Here is an
extract from his explanations :
GTB is a program that lets you draw graphic user interfaces on the
screen with a mouse. You place a button on the screen and GTB works
out the pixel counts. There are options to do things like spreading
gadgets out evenly and aligning them with each other and such like.
(but don`t worry about that.)
Andrew also provided a step-by-step guide of the kind I love, and
often need. Here are the steps, largely as sent, but slightly
extended in the light of my subsequent explorations.
From the very start, there are four stages to getting a gui to appear
when you run an ARexx program :
[A] Installing at least the minimum of Gadtoolsbox
[B] Using Gadtoolsbox to create a gui
[C] Launching 'varexx'
[D] Using your gui in an ARexx program
[A] The minimum of Gadtoolsbox needed for 'varexx'
A.1
Copy 'nofrag.library' and 'gadtoolsbox.library' into libs:
A.2
Delete everything else in the Gadtools package except the
Gadtoolsbox program itself, it's icon and the doc files. (Don't
you just love it when you can do things like that?)
[B] The first exploratory use of Gadtoolsbox
B.1
Run the program
B.2
You will see an open window entitled 'Work Window'
B.3
Use the menus. Select the second menu (Gadgets), its first item
(KIND), and 'BUTTON' from the sub-menu of 'KIND'.
B.4
With the left mouse button, drag out a rectangle in the window.
A requester will appear when you release the button.
B.5
Type a name (say, BUTTON) in the box labelled 'LABEL' and some
text into the text string gadget. This text will appear in the button
in the window.
B.6
Use the first menu 'Save As' option and save the file somewhere.
'Rexx:gui/Button1.gui' is suggested.
Hint 1
The docs make it clear, but it's easy to overlook,
that varexx doesn't like gui files to be crunched - refuses to work
if they are - and the copy of GTB as you down-load it may have the
Crunch option set to ON. Do this to check : Before you leave
Gadtoolsbox, select Preferences from the first menu. If the Crunch
option is shown as being ON, with a tick, then click on it to turn it
off, save the prefs, and then re-save your trial gui.
Hint 2
. Already I have realised the value of fixing a
regular 'gui' location for my work. In imitation of other 'varexx'
examples I have seen, I now put all products from Gadtoolsbox into
a specifically created directory 'rexx:gui/'.
[C] Launch 'varexx'
C.1
Go to a shell
C.2
Find and run 'varexx'; something like "work:Varexx/bin>
varexx", or simpler, as Andrew suggests, just make sure that a
copy of varexx is in your current working directory.
[D] Use your gui in an ARexx program
D.1
Find the 'testgui.rexx' script and run it. Like this :
From shell :
Line 1 : varexx/scripts
Line 2 : rx testgui.rexx rexx:gui/Button1.gui
That is, when you run a varexx script from a shell, it expects as an
argument, after its own name, the full path and name of the gui which
you saved in [B.6] above.
D.2
Your window should appear, that is, the one you designed in
Gadtoolsbox.
Click on the Button which you created. It will send a message to the
shell window from which you ran 'testgui.rexx'. That message will be
whatever LABEL you gave the button when you created it.
That's the crucial point, the central idea which will be extended below.
A message is being passed from one window to another.
D.3
Close the window to exit.
My explorations
1
Stretching testgui.rexx and vasample.rexx
GadToolsBox was not the awesome monster I had feared, but an easy
and very versatile way of creating GUI elements you wish to use. It
has heaps of menus, most of which I haven't even tried out yet.
Don't be afraid of it. Just explore.
The nice examples included with varexx contain 'testgui.rexx' already
referred to above. My first tentative solo steps simply used that
program with gadgets other than a button, and then with several
different gadgets in one window. To get used to it, try selecting
different gadget types, to create something like this (excuse the
rough graphics here) :
_____
Check box [ ] Button | |
_____ |_____|
Integer [_____]
_______
Cycle [@|_____]
Depending on what labels you insert, and what you then do with the
gadgets when you run 'testgui.rexx', you should get this sort of
feedback to your actions being displayed in your shell window :
CHECK1 TRUE
BUTTON1
INTEGER 42567
CYCLE 1
CYCLE 2
CYCLE 0
CLOSEWINDOW
I then duplicated this output using vasample.rexx instead of
testgui.rexx, just to feel that I was gaining some independence, and
soon started finding out how flexible and forgiving varexx is. For
example, despite what I said above :
(1) You don't
have
to launch varexx before running an ARexx
program which uses it. Instead, you can include a patch in the
program to check whether or not 'varexx' has already been launched
and act accordingly.
if show( 'p', 'VAREXX' ) ~= 1 then do
address command 'run Varexx'
address command 'waitforport VAREXX' *
end
* Andrew's version of this line was : waitforport VAREXX
I found that the extended version I have shown here worked better.
I mentioned this to Andrew. He agrees.
(2) You don't
have
to add a gui path and name as an argument
when using testgui.rexx. If you don't, a requester prompts you for
the filename. Of course in your own developmental work, the gui path
and name are probably predefined like this :
'load rexx:gui/FourTypes.gui WINDOWPORT'
Or early in the program, for convenience :
gui_name = rexx:gui/FourTypes.gui
And then, when needed :
'load ' gui_name ' WINDOWPORT'
In these various explorations, as soon as I felt I was beginning to
get some sort of control over what was happening, I got slightly more
ambitious.
2
A 'rexxarplib.library' window AND varexx
I opened a rexxarplib window, with a plain old-fashioned gadget.
When I click on it, a varexx gui appears, inviting whatever
user-input is required. It sounds trivial, but it has enormous
potential, and was significant for me because it confirmed that
messages can be passed between the two types of window.
Instead of the confirming feedback messages such as
CHECK1 TRUE BUTTON1 INTEGER 42567 CYCLE 1 CYCLE 2
CYCLE 0 CLOSEWINDOW
appearing in the CLI window, they are passed back from a varexx-using
function to the parent window, where they can be displayed however
I choose, or not. Any of them
can
be used as the basis for
more complex actions in the parent window....
3
Using instructions returned from varexx
I created a Gadtoolsbox window something like this, with a string
entry gadget, an x and y slider to fix the position of the string,
and a colour selector gadget to determine its colour :
_______________________________________
Entry [_______________________________________]
______________ ______________
x pos [_
____________] y pos [_
____________]
_________________
Text [ (samples here) ]
colour [_________________]
When the varexx window is closed, the data is passed back to the
parent window, and used to place the string, as specified, in that
window.
There are many more possible elements for inclusion in the varexx
window, and dozens of user interactions which could be varexx-
controlled, such as :
What shape do you want to draw?
What IFF image do you want to load?
What new gadget do you want to add?
Where? What colour? How many? And so on.
4
Access to DosMan
DosMan is available from aminet:util/wb/DosMan121.lha
When Peter Bagnato put DosMan together, he used amiga.guide as the
presenter of a complete DOS manual. Two other methods of
presentation were discussed and tried, and they both worked
smoothly.
- A small plain ARexx program using the FileList() function
- A HyperBook unit using that system's List and Note features
The new challenge was at least to match their performance using
varexx. This time, the kind of gadget put into a gui via
Gadtoolsbox was a ListView.
Stages within the program which use it are as follows :
Set 'options results'
If necessary, open libraries and load varexx
Set 'address VAREXX'
Open a port
Load the gui
Set host to port for gui
Build the list :
A copy of the 'man' directory into Ram: via 'list'
Open the list file.
Read line by line from the list file, and assign each item to an
array. That array will be read into the 'ListView' gadget.
Close the list file.
Display the window
Use varexx 'setlist' command to fill the list
Start a loop, until the user closes the window
Wait for a message
Get the message. Examine it.
If it is not empty, parse it.
If the first word is DOSLIST,
then the second word is the target 'man' file
Use a viewer (like FullView) to display it.
If the message is CLOSEWINDOW
then unload the gui file
close the port
exit
I am not going to try to render every detail of the output here, but
the diagram below is intended to suggest an outer window (the varexx
window), an inner 'List' gadget, and a black slider.
Whichever list item you click on, the required text is displayed
(in less than 2 seconds on my machine).
___________________
|_|_DosMan______|_|_|
|________________ | |
||AddBuffers |
|| |
||AddDataTypes |
|| |
||Alias |
|| |
||Ask |
|| |
||Assign | || |
||Asterix(*) | || |
||Avail | || |
||BackTick | || |
||BaseName | || |
||Binddrivers | || |
||Break | || |
||CD | || |
||ChangeTaskPri| || |
||Cmpas | || |
||Conclip | || |
||Copy | || |
||CPU | || |
||Date | || |
||Delete | || |
||Dir | || |
||_____________|_||_|
|_________________|_|
As you pull the slider down, the list scrolls up, and if you go all
the way, you will reach the last few of more than 90 items.:
.. . .. .
.. . .. .
||Wait |
|| |
||Which |
|| |
||Why |
|| |
||_____________|_||_|
|_________________|_|
My access to DosMan has been easy ever since I got it, and varexx has
given me another way of arranging for that to be so.
5
Access to Pix, my fastest yet
During recent weeks I've been exploring ways of reducing the time it
takes to screen a JPEG or similar picture. I have found that while
FJPEG or Viewtek perform well, especially the former with JPEG files,
I can get an even faster screening by using QuickGrab, which produces
picture files QuickGrab.000, QuickGrab.001, and so on in Ram:. If
these are renamed, saved in a directory, and then Viewtek is used,
they screen
very
rapidly, practically instantly.
I have combined this strategy with a variation on the Dosman approach
described above and, just for variety, did it using a set of button
gadgets instead of a list. For each button gadget entered in the
gui, the LABEL and the TEXT are identical. This means that whatever
gadget I click on, that text of the gadget is passed as 'class' to
a Viewtek command, and the picture of that name appears.
if class ~= closewindow then address command 'vt pix/' || class
else leave
Using gadgets does, of course, put a high upper limit on how many can
be handled comfortably, and in fact, since writing these paragraphs, I
have changed the method of access from gadgets to a file lister.
6
A varexx version of ToolManager
A possible new direction became clear. If I could use varexx to
draw up a list to view texts, or to assemble gadgets to choose a
picture, it was going to be quite easy to arrange a display of
buttons, gadgets, lists, or whatever, to launch any of the tools I
use in my day-to-day Amiga work : one of them to run my terminal
program, another to run Browser, and so on, for IconEdit, palette,
Calculator, QED, DPaint, AmigaVision, HyperBook .. whatever I want
to use.
It's up and running, now, and it's great! I can tinker with the
layout and appearance to my heart's content, and change it easily
at any time. The zoom gadget on the varexx window will iconify it
when I want it out of the way.
Conclusion
I've still got heaps of exploring to do with Gadtoolsbox and varexx,
and I'm looking around for a major application to put them and me
really to the test.
Meanwhile, many thanks to Andrew Cook for 'varexx', and for his
kind and patient responses to my communication.
And many thanks to Peter Bagnato, for 'DosMan' and much more.
Hamilton, New Zealand January 1996
------------------------------